<template>
	<view>
		<form>
			<view class='personal-data'>
				<view class='list'>
					<view class='item acea-row row-between-wrapper'>
						<view>原始密码</view>
						<view class='input'><input type='password'  placeholder="请填写原始密码" v-model='postData.oldPassword'></input>
						</view>
					</view>
				</view>
				<view class='list'>
					<view class='item acea-row row-between-wrapper'>
						<view>新密码</view>
						<view class='input'><input type='password'  placeholder="不要与账户编号一致" v-model='postData.newPassword'></input>
						</view>
					</view>
				</view>
				<view class='list'>
					<view class='item acea-row row-between-wrapper'>
						<view>确认新密码</view>
						<view class='input'><input type='password' placeholder="请填写新密码" v-model='postData.newPassword1'></input>
						</view>
					</view>
				</view>
				<button class='modifyBnt' @click="submit">保存修改</button>
			</view>
		</form>
	</view>
</template>

<script>
	import {
		payPasswordSubmit
	} from "@/api/directSelling.js"
	export default {
		data() {
			return {
				postData: {},
			};
		},
		methods: {
			submit(){
				if(!this.postData.oldPassword){
					this.$util.Tips({
						title: '原始密码不能为空！'
					})
					return;
				}
				if(!this.postData.newPassword){
					this.$util.Tips({
						title: '请填写新密码！'
					})
					return;
				}
				if(!this.postData.newPassword1){
					this.$util.Tips({
						title: '确认密码不能为空！'
					})
					return;
				}
				if(this.postData.newPassword!==this.postData.newPassword1){
					this.$util.Tips({
						title: '两次输入密码不一致！'
					})
					return;
				}
				var reg = /(?=.*[0-9])(?=.*[a-zA-Z]).{6,16}/;
				 if(!reg.test(this.postData.newPassword)){
				    this.$util.Tips({
				    	title: '密码必须由数字、字母组合,请输入6-16位！'
				    })
				    return;                
				}
				let parse="?oldPwd="+this.postData.oldPassword+"&newPwd="+this.postData.newPassword+"&sureNewPwd="+this.postData.newPassword;
				payPasswordSubmit(parse).then(res=>{
					if(res.meta.success==true){
						this.$util.Tips({
							title: '密码修改成功！'
						})
						setTimeout(()=>{
							uni.navigateTo({
								url: "/pages/zx_users/updatepwd/index"
							});
						},1500)
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.personal-data .wrapper {
		margin: 10rpx 0;
		background-color: #fff;
		padding: 36rpx 30rpx 13rpx 30rpx;
	}

	.personal-data .wrapper .title {
		margin-bottom: 30rpx;
		font-size: 32rpx;
		color: #282828;
	}

	.personal-data .wrapper .wrapList .item {
		width: 690rpx;
		height: 160rpx;
		background-color: #f8f8f8;
		border-radius: 20rpx;
		margin-bottom: 22rpx;
		padding: 0 30rpx;
		position: relative;
		border: 2rpx solid #f8f8f8;
		box-sizing: border-box;
	}

	.personal-data .wrapper .wrapList .item.on {
		border-color: #e93323;
		border-radius: 20rpx;
		background-image: url("");
		background-size: 100% 100%;
		background-color: #fff9f9;
		background-repeat: no-repeat;
	}

	.personal-data .wrapper .wrapList .item .picTxt {
		width: 445rpx;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue {
		width: 96rpx;
		height: 96rpx;
		position: relative;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue .alter {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		position: absolute;
		bottom: 0;
		right: 0;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text {
		width: 325rpx;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text .name {
		width: 100%;
		font-size: 30rpx;
		color: #282828;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text .phone {
		font-size: 24rpx;
		color: #999;
		margin-top: 10rpx;
	}

	.personal-data .wrapper .wrapList .item .bnt {
		font-size: 24rpx;
		background-color: #fff;
		border-radius: 27rpx;
		width: 140rpx;
		height: 54rpx;
		border: 2rpx solid #e93323;
	}

	.personal-data .wrapper .wrapList .item .currentBnt {
		position: absolute;
		right: 0;
		top: 0;
		font-size: 26rpx;
		background-color: rgba(233, 51, 35, 0.1);
		width: 140rpx;
		height: 48rpx;
		border-radius: 0 20rpx 0 20rpx;
	}

	.personal-data .list {
		margin-top: 15rpx;
		background-color: #fff;
	}

	.personal-data .list .item {
		padding: 30rpx 30rpx 30rpx 0;
		border-bottom: 1rpx solid #f2f2f2;
		margin-left: 30rpx;
		font-size: 32rpx;
		color: #282828;
	}

	.personal-data .list .item .phone {
		width: 160rpx;
		height: 56rpx;
		font-size: 24rpx;
		color: #fff;
		line-height: 56rpx;
		border-radius: 32rpx
	}

	.personal-data .list .item .pictrue {
		width: 88rpx;
		height: 88rpx;
	}

	.personal-data .list .item .pictrue image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}

	.personal-data .list .item .input {
		width: 415rpx;
		text-align: right;
		color: #868686;
	}

	.personal-data .list .item .input .id {
		width: 365rpx;
	}

	.personal-data .list .item .input .iconfont {
		font-size: 35rpx;
	}

	.personal-data .modifyBnt {
		font-size: 32rpx;
		color: #fff;
		width: 690rpx;
		height: 90rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 90rpx;
		margin: 76rpx auto 0 auto;
		background: $theme-color;
	}

	.personal-data .logOut {
		font-size: 32rpx;
		text-align: center;
		width: 690rpx;
		height: 90rpx;
		border-radius: 45rpx;
		margin: 30rpx auto 0 auto;
	}

	.avatar-box {
		width: 96rpx;
		height: 96rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}
</style>
